using IRepository;
using IServices;
using SqlSugar;
using System.Collections.Generic;
using YL.Core.Dto;
using YL.Core.Entity;
using YL.Utils.Json;
using YL.Utils.Pub;
using YL.Utils.Table;

namespace Services
{
    public class Whr_contentServices : BaseServices<Whr_content>, IWhr_contentServices
    {
        private readonly SqlSugarClient _client;
        public Whr_contentServices(SqlSugarClient client, IWhr_contentRespository repository) : base(repository)
        {
            _client = client;
        }

        public List<AdDto> GetAd()
        {
            var query = _client.Queryable<Whr_content>()
                .Where(c => c.Status == 1)
                .Select(c => new 
                AdDto {                    
                    Title = c.Title,
                    Img = c.Image,
                    Url = c.Url                
                })
                .OrderBy("id desc, list_order asc");            
            return query.ToList();
        }
    }
}